//Source file: D:\\test\\com\\ce\\pms\\charge\\model\\CreditTransDomain.java

package com.ce.pms.charge.model;

import java.math.BigDecimal;

import javax.persistence.*;

import com.ce.pms.common.model.SysInfo;
import com.ce.pms.exception.BusinessException;
import com.ce.util.BlankUtil;
import com.sitechasia.webx.core.model.IDomainObject;

/**
 * 实收交易
 * @author Adama Yue
 * @CreateDate:2008-7-14
 */
@Entity
@DiscriminatorValue("CR")
public class CreditTransDomain extends AbstractTrans {
	@Override
	public void checkRequiredField() {
		super.checkRequiredField();
		if (this.credit==null) {
			throw new BusinessException("common:mustFill_null_exception",
					BusinessException.WARNING);
		}
//		if (1 == BigDecimal.ZERO.compareTo(this.credit)) {
//			throw new BusinessException("charge:charge_transaction_not_zero_exception",BusinessException.WARNING);
//		}
	}
	/**
	 * 贷
	 */
	@Column(name = "CREDIT", precision = 18, scale = 2)
	private BigDecimal credit = new BigDecimal("0.00");

	/**
	 * 收费凭证
	 */
	@ManyToOne
	@JoinColumn(name="VOUCHER_ID")
	private VoucherDomain voucher;

	/**
	 * @roseuid 48757D1300FA
	 */
	public CreditTransDomain() {
	}
	/**
	 *
	 * @param period       收费周期
	 * @param businessCode 交易码
	 * @param staVersion   收费标准版本
	 * @param bindingAccount 子帐户
	 * @param clazz        类型
	 *                     支付类交易: 005支付主交易;006支付子交易(多重支付);
	 * @param voucher      凭证
	 * @param sysInfo      系统信息
	 */
	public CreditTransDomain(PeriodDomain period, BusinessCodeDomain businessCode,  AbstractSubAccount bindingAccount, String clazz, VoucherDomain voucher, SysInfo sysInfo) {
		super(period, businessCode,  bindingAccount, clazz, sysInfo);
		this.voucher = voucher;
	}

	public BigDecimal getCredit() {
		return credit;
	}
	public void setCredit(BigDecimal credit) {
		this.credit = credit;
	}
	public VoucherDomain getVoucher() {
		return voucher;
	}
	public void setVoucher(VoucherDomain voucher) {
		this.voucher = voucher;
	}


}
